package com.dkm.ec.relation.domain;

import java.util.Date;

import javax.annotation.Resource;

import org.springframework.context.annotation.EnableLoadTimeWeaving;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;

import com.dkm.biz.domain.AbstractDomain;
import com.dkm.base.core.helper.SpringHelper;
import com.dkm.ec.relation.persistence.dao.RelationSessionDao;
import com.dkm.ec.relation.persistence.entity.RelationSessionPo;
import com.dkm.ec.relation.persistence.entity.RelationSessionPoStatus;
import com.dkm.ec.relation.repository.RelationSessionRepository;

/**
 * 对象功能:t_relation_session 领域对象实体
 * 开发公司:dkm.com
 * 开发人员:ZHH
 * 创建时间:2017-07-22 16:33:03
 */
@SuppressWarnings("serial")
@Service
@Scope("prototype")
public class RelationSession extends AbstractDomain<String, RelationSessionPo>{
	 
	 private RelationSessionDao relationSessionDao = null;
	 @Resource
	 private RelationSessionRepository relationSessionRepository;

	protected void init(){
		relationSessionDao = SpringHelper.getBean(RelationSessionDao.class);
		setDao(relationSessionDao);
	}

	public void createSessionByParty(String partyId, String requestPartyId, RelationSessionPoStatus singleChat) {
		RelationSessionPo relationSessionPo = new RelationSessionPo();
		relationSessionPo.setPartyId(partyId);
		relationSessionPo.setEntityId(requestPartyId);
		relationSessionPo.setType(singleChat.toString());
		relationSessionPo.setCreateTime(new Date());
		RelationSession relationSession = relationSessionRepository.newInstance(relationSessionPo);
		relationSession.create();
	}	 
	 
}
